package com.qiyeji.real_estate.service;

import com.qiyeji.real_estate.entity.payroll;
import com.qiyeji.real_estate.entity.payrollKey;
import com.qiyeji.real_estate.mapper.payrollMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

@Service
public class PayrollService {
    @Autowired
    payrollMapper payrollMapper;

    //添加薪资信息
    public Integer addPayroll(payroll record) {
        return payrollMapper.insertSelective(record);
    }

    //获取全部薪资信息
    public List<payroll> getAllPayroll() {
        return payrollMapper.getAllPayroll();
    }

    //通过职工号和日期修改薪资信息
    public Integer alterPayroll(payroll record) {
        return payrollMapper.updateByPrimaryKeySelective(record);
    }

    //通过职工号和日期删除薪资信息
    public Integer deletePayroll(payrollKey record) {
        return payrollMapper.deleteByPrimaryKey(record);
    }

    //通过职工姓名查询薪资信息
    public List<payroll> getPayrollBySName(String sName) {
        return payrollMapper.getPayrollBySName(sName);
    }

    //通过日期查询薪资信息
    public List<payroll> getPayrollByDate(String Date) {
        return payrollMapper.getPayrollByDate(Date);
    }

    //通过部门查询薪资信息
    public List<payroll> getPayrollByD(String dName) {
        return payrollMapper.getPayrollByD(dName);
    }

    public CopyOnWriteArrayList<payroll> getPayrollForExcel(String date) {
        return payrollMapper.getPayrollForExcel(date);
    }

}
